import {RouteRecordRaw} from "vue-router";
import ACCESS_ENUM from "../access/accessEnum.ts";

export const routes: Array<RouteRecordRaw> = [
    {
        path:"/",
        redirect:"/index"
    },
    {
        path: "/index",
        name: "首页",
        // @ts-ignore
        component: () => import("../view/Index.vue"),
    },
    {
        path: "/user/login",
        name: "登录",
        // @ts-ignore
        component: () => import("../view/Login.vue"),
        meta: {
            //表示是否展示在菜单导航
            isHidden: true,
        },
    },
    {
        path: "/user/register",
        name: "注册",
        // @ts-ignore
        component: () => import("../view/Register.vue"),
        meta: {
            //表示是否展示在菜单导航
            isHidden: true,
        },
    },
    {
        path: "/businessList",
        name: "商家列表",
        props: route => ({ key: route.fullPath }),
        // @ts-ignore
        component: () => import("../view/BusinessList.vue"),
    },
    {
        path: "/businessType/:id",
        name: "商家类型",
        props: route => ({ key: route.fullPath }),
        // @ts-ignore
        component: () => import("../view/BusinessList.vue"),
    },{
        path: "/businessInfo/:id",
        name: "商品页面",
        // @ts-ignore
        component: () => import("../view/BusinessInfo.vue"),
    },
    {
        path: "/confirm/:id",
        name: "订单确认",
        // @ts-ignore
        component: () => import("../view/ConfirmOrder.vue"),
        meta: {
            //表示是否展示在菜单导航
            isHidden: true,
            access: ACCESS_ENUM.USER,
        },
    },
    {
        path: "/createOrder",
        name: "创建订单",
        // @ts-ignore
        component: () => import("../view/CreateOrder.vue"),
        meta: {
            access: ACCESS_ENUM.USER,
        },
    },
    {
        path: "/order",
        name: "我的订单",
        // @ts-ignore
        component: () => import("../view/Order.vue"),
    },
    {
        path: "/userAddress",
        name: "我的地址",
        // @ts-ignore
        component: () => import("../view/UserAddress.vue"),
        meta: {
            access: ACCESS_ENUM.USER,
        },
    },
    {
        path: "/addAddress",
        name: "新增地址",
        props: route => ({ key: route.fullPath }),
        // @ts-ignore
        component: () => import("../view/AddUserAddress.vue"),
        meta: {
            access: ACCESS_ENUM.USER,
        },
    },
    {
        path: "/editAddress/:id",
        name: "修改地址",
        props: route => ({ key: route.fullPath }),
        // @ts-ignore
        component: () => import("../view/AddUserAddress.vue"),
        meta: {
            access: ACCESS_ENUM.USER,
        },
    },
    {
        path: "/pay/:id",
        name: "订单支付",
        // @ts-ignore
        component: () => import("../view/Payment.vue"),
        meta: {
            access: ACCESS_ENUM.USER,
        },
    },
    {
        path: "/my",
        name: "我的",
        // @ts-ignore
        component: () => import("../view/My.vue"),
    }
]
